package request

import (
	"time"

	"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
	"github.com/flipped-aurora/gin-vue-admin/server/plugin/gva_intelligent_form/model"
)

// IntelligentFormSearch 表单搜索结构体
type IntelligentFormSearch struct {
	model.IntelligentForm
	StartCreatedAt *time.Time `json:"startCreatedAt" form:"startCreatedAt"`
	EndCreatedAt   *time.Time `json:"endCreatedAt" form:"endCreatedAt"`
	request.PageInfo
}

// CreateIntelligentFormRequest 创建表单请求
type CreateIntelligentFormRequest struct {
	Title       string      `json:"title" validate:"required,min=1,max=255" binding:"required"`
	Description string      `json:"description"`
	FormConfig  interface{} `json:"formConfig"`
	ThemeConfig interface{} `json:"themeConfig"`
	SubmitLimit int         `json:"submitLimit"`
	IsPublic    bool        `json:"isPublic"`
	Password    string      `json:"password"`
	StartTime   *time.Time  `json:"startTime"`
	EndTime     *time.Time  `json:"endTime"`
	FormType    string      `json:"formType"`
}

// UpdateIntelligentFormRequest 更新表单请求
type UpdateIntelligentFormRequest struct {
	ID          uint        `json:"id" validate:"required"`
	Title       string      `json:"title" validate:"required,min=1,max=255" binding:"required"`
	Description string      `json:"description"`
	FormConfig  interface{} `json:"formConfig"`
	ThemeConfig interface{} `json:"themeConfig"`
	SubmitLimit int         `json:"submitLimit"`
	IsPublic    bool        `json:"isPublic"`
	Password    string      `json:"password"`
	StartTime   *time.Time  `json:"startTime"`
	EndTime     *time.Time  `json:"endTime"`
	FormType    string      `json:"formType"`
}

// PublishFormRequest 发布表单请求
type PublishFormRequest struct {
	ID uint `json:"id" validate:"required"`
}

// CloseFormRequest 关闭表单请求
type CloseFormRequest struct {
	ID uint `json:"id" validate:"required"`
}
